#ifndef EM_PORT_API
#   if defined(__EMSCRIPTEN__)
#       include <emscripten.h>
#       if defined(__cplusplus)
#           define EM_PORT_API(rettype) extern "C" rettype EMSCRIPTEN_KEEPALIVE
#       else
#           define EM_PORT_API(rettype) rettype EMSCRIPTEN_KEEPALIVE
#       endif
#   else
#       if defined(__cplusplus)
#           define EM_PORT_API(rettype) extern "C" rettype
#       else
#           define EM_PORT_API(rettype) rettype
#       endif
#   endif
#endif
//mem.cc
#include <stdio.h>

int g_int = 42;
double g_double = 3.1415926;

EM_PORT_API(int *)
get_int_ptr()
{
  return &g_int;
}

EM_PORT_API(double *)
get_double_ptr()
{
  return &g_double;
}

EM_PORT_API(void)
print_data()
{
  printf("C{g_int:%d}\n", g_int);
  printf("C{g_double:%lf}\n", g_double);
}